<?php
namespace BP\Sys;

use BP\En\EntityMyPK;

require_once("BP/En/Map.php");
class FrmLab extends EntityMyPK {
	public function getFontStyle () 
	{
		return $this->GetValStringByKey(FrmLabAttr::$FontStyle);
	}
	public function setFontStyle ($value) // [String value]
	{
		$this->SetValByKey(FrmLabAttr::$FontStyle, $value);
	}
	public function getFontColorHtml () 
	{
		return PubClass::ToHtmlColor($this->getFontColor());
	}
	public function getFontColor () 
	{
		return $this->GetValStringByKey(FrmLabAttr::$FontColor);
	}
	public function setFontColor ($value) // [String value]
	{
		switch ($value) {
			case "#FF000000":
				$this->SetValByKey(FrmLabAttr::$FontColor, "Red");
				return ;
			default:
				break;
		}
		$this->SetValByKey(FrmLabAttr::$FontColor, $value);
	}
	public function getFontWeight () 
	{
		return $this->GetValStringByKey(FrmLabAttr::$FontWeight);
	}
	public function setFontWeight ($value) // [String value]
	{
		$this->SetValByKey(FrmLabAttr::$FontWeight, $value);
	}
	public function getIsBold () 
	{
		return $this->GetValBooleanByKey(FrmLabAttr::$IsBold);
	}
	public function setIsBold ($value) // [boolean value]
	{
		$this->SetValByKey(FrmLabAttr::$IsBold, $value);
	}
	public function getIsItalic () 
	{
		return $this->GetValBooleanByKey(FrmLabAttr::$IsItalic);
	}
	public function setIsItalic ($value) // [boolean value]
	{
		$this->SetValByKey(FrmLabAttr::$IsItalic, $value);
	}
	public function getFontName () 
	{
		return $this->GetValStringByKey(FrmLabAttr::$FontName);
	}
	public function setFontName ($value) // [String value]
	{
		$this->SetValByKey(FrmLabAttr::$FontName, $value);
	}
	public function getY () 
	{
		return $this->GetValFloatByKey(FrmLabAttr::$Y);
	}
	public function setY ($value) // [float value]
	{
		$this->SetValByKey(FrmLabAttr::$Y, $value);
	}
	public function getX () 
	{
		return $this->GetValFloatByKey(FrmLabAttr::$X);
	}
	public function setX ($value) // [float value]
	{
		$this->SetValByKey(FrmLabAttr::$X, $value);
	}
	public function getFontSize () 
	{
		return $this->GetValIntByKey(FrmLabAttr::$FontSize);
	}
	public function setFontSize ($value) // [int value]
	{
		$this->SetValByKey(FrmLabAttr::$FontSize, $value);
	}
	public function getFK_MapData () 
	{
		return $this->GetValStrByKey(FrmLabAttr::$FK_MapData);
	}
	public function setFK_MapData ($value) // [String value]
	{
		$this->SetValByKey(FrmLabAttr::$FK_MapData, $value);
	}
	public function getText () 
	{
		return $this->GetValStrByKey(FrmLabAttr::$Text);
	}
	public function setText ($value) // [String value]
	{
		$this->SetValByKey(FrmLabAttr::$Text, $value);
	}
	public function getTextHtml () 
	{
		if ($this->getIsBold())
		{
			return (("<b>" . $this->GetValStrByKey(FrmLabAttr::$Text)->replace("@", "<br>")) . "</b>");
		}
		else
		{
			return $this->GetValStrByKey(FrmLabAttr::$Text)->replace("@", "<br>");
		}
	}
	public static function constructor__ () 
	{
		$me = new self();
		return $me;
	}
	public static function constructor__String ($mypk) // [String mypk]
	{
		$me = new self();
		$me->setMyPK($mypk);
		$me->Retrieve();
		return $me;
	}
	public function getEnMap () 
	{
		if (($this->get_enMap() != NULL))
		{
			return $this->get_enMap();
		}
		$map = new Map("Sys_FrmLab", "标签");
		$map->Java_SetDepositaryOfEntity($Depositary->None);
		$map->Java_SetDepositaryOfMap($Depositary->Application);
		$map->Java_SetEnType($EnType->Sys);
		$map->IndexField = FrmImgAthDBAttr::$FK_MapData;
		$map->AddMyPK();
		$map->AddTBString(FrmLabAttr::$FK_MapData, NULL, "FK_MapData",  TRUE ,  FALSE , 1, 100, 20);
		$map->AddTBString(FrmLabAttr::$Text, "New Label", "Label",  TRUE ,  FALSE , 0, 3900, 20);
		$map->AddTBFloat(FrmLabAttr::$X, 5, "X",  TRUE ,  FALSE );
		$map->AddTBFloat(FrmLabAttr::$Y, 5, "Y",  FALSE ,  FALSE );
		$map->AddTBInt(FrmLabAttr::$FontSize, 12, "字体大小",  FALSE ,  FALSE );
		$map->AddTBString(FrmLabAttr::$FontColor, "black", "颜色",  TRUE ,  FALSE , 0, 50, 20);
		$map->AddTBString(FrmLabAttr::$FontName, NULL, "字体名称",  TRUE ,  FALSE , 0, 50, 20);
		$map->AddTBString(FrmLabAttr::$FontStyle, "normal", "字体风格",  TRUE ,  FALSE , 0, 200, 20);
		$map->AddTBString(FrmLabAttr::$FontWeight, "normal", "字体宽度",  TRUE ,  FALSE , 0, 50, 20);
		$map->AddTBInt(FrmLabAttr::$IsBold, 0, "是否粗体",  FALSE ,  FALSE );
		$map->AddTBInt(FrmLabAttr::$IsItalic, 0, "是否斜体",  FALSE ,  FALSE );
		$map->AddTBString(FrmLabAttr::$GUID, NULL, "GUID",  TRUE ,  FALSE , 0, 128, 20);
		$this->set_enMap($map);
		return $this->get_enMap();
	}
	public function IsExitGenerPK () 
	{
		$sql = (((((((((("SELECT COUNT(*) FROM " . $this->getEnMap()->getPhysicsTable()) . " WHERE FK_MapData='") . $this->getFK_MapData()) . "' AND X=") . $this->getX()) . " AND Y=") . $this->getY()) . "  and Text='") . $this->getText()) . "'");
		if ((DBAccess->RunSQLReturnValInt($sql, 0) == 0))
		{
			return  FALSE ;
		}
		return  TRUE ;
	}
}
?>
